package cn.iocoder.yudao.module.infra.embedding.impl.mock;

import cn.iocoder.yudao.module.infra.embedding.EmbeddingConfig;
import cn.iocoder.yudao.module.infra.embedding.IEmbeddingService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service("embedding-mock")
public class MockEmbeddingServiceImpl implements IEmbeddingService {
    @Resource
    private EmbeddingConfig embeddingConfig;

    @Override
    public List<? extends Number> create(String text) {
        final EmbeddingConfig.Config primaryService = embeddingConfig.getPrimaryService();
        final Integer dimensions = primaryService.getDimensions();

        // 模拟数据，生成维度为dimensions的随机向量
        final List<Float> mockEmbedding = new java.util.ArrayList<>();
        for (int i = 0; i < dimensions; i++) {
            mockEmbedding.add(Float.valueOf(1));
        }

        return mockEmbedding;
    }

}
